<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>

<script>
    const obj = {
        name: "ljw",
        age: 23,
        college: "UCAS"
    }

    // 直接存储，无法直接使用，会被转化成字符串
    // localStorage.setItem("obj", obj)

    // 应该序列化进行存储，使用JSON
    objson = JSON.stringify(obj)
    localStorage.setItem("obj", objson)

    console.log(localStorage.getItem("obj"))

    let myobj = JSON.parse(localStorage.getItem("obj"))

    console.log(myobj)
</script>
    
</body>
</html>